import api from './index'

export const studyApi = {
  // 学习记录相关API
  studyRecords: {
    // 获取学习记录列表
    getRecords(userId) {
      return api.get('/api/study-records', { params: { userId } })
    },
    
    // 创建学习记录
    createRecord(record) {
      return api.post('/api/study-records', record)
    },
    
    // 更新学习记录
    updateRecord(id, record) {
      return api.put(`/api/study-records/${id}`, record)
    },
    
    // 删除学习记录
    deleteRecord(id) {
      return api.delete(`/api/study-records/${id}`)
    },
    
    // 按科目获取记录
    getRecordsBySubject(userId, subject) {
      return api.get('/api/study-records/by-subject', { 
        params: { userId, subject } 
      })
    },
    
    // 按日期范围获取记录
    getRecordsByDateRange(userId, startDate, endDate) {
      return api.get('/api/study-records/by-date-range', { 
        params: { userId, startDate, endDate } 
      })
    },
    
    // 获取学习统计
    getStatistics(userId, startDate, endDate) {
      return api.get('/api/study-records/statistics', { 
        params: { userId, startDate, endDate } 
      })
    },
    
    // 获取总学习时长
    getTotalTime(userId, startDate, endDate) {
      return api.get('/api/study-records/total-time', { 
        params: { userId, startDate, endDate } 
      })
    },
    
    // 获取科目学习时长分布
    getTimeBySubject(userId, startDate, endDate) {
      return api.get('/api/study-records/time-by-subject', { 
        params: { userId, startDate, endDate } 
      })
    },
    
    // 获取每日学习趋势
    getDailyTrend(userId, startDate, endDate) {
      return api.get('/api/study-records/daily-trend', { 
        params: { userId, startDate, endDate } 
      })
    },
    
    // 获取效率指数
    getEfficiencyIndex(userId, startDate, endDate) {
      return api.get('/api/study-records/efficiency-index', { 
        params: { userId, startDate, endDate } 
      })
    }
  },

  // 学习计划相关API
  studyPlans: {
    // 获取学习计划列表
    getPlans(userId) {
      return api.get('/api/study-plans', { params: { userId } })
    },
    
    // 获取活跃计划
    getActivePlans(userId) {
      return api.get('/api/study-plans/active', { params: { userId } })
    },
    
    // 创建学习计划
    createPlan(plan) {
      return api.post('/api/study-plans', plan)
    },
    
    // 更新学习计划
    updatePlan(id, plan) {
      return api.put(`/api/study-plans/${id}`, plan)
    },
    
    // 删除学习计划
    deletePlan(id) {
      return api.delete(`/api/study-plans/${id}`)
    },
    
    // 获取逾期计划
    getOverduePlans(userId) {
      return api.get('/api/study-plans/overdue', { params: { userId } })
    },
    
    // 获取即将到期计划
    getDueSoonPlans(userId) {
      return api.get('/api/study-plans/due-soon', { params: { userId } })
    },
    
    // 获取计划进度
    getPlanProgress(userId) {
      return api.get('/api/study-plans/progress', { params: { userId } })
    }
  },

  // 学习核算相关API
  studyAccounting: {
    // 获取资产负债表
    getBalanceSheet(userId) {
      return api.get('/api/study-accounting/balance-sheet', { params: { userId } })
    },
    
    // 获取损益表
    getIncomeStatement(userId, startDate, endDate) {
      return api.get('/api/study-accounting/income-statement', { 
        params: { userId, startDate, endDate } 
      })
    },
    
    // 获取现金流量表
    getCashFlow(userId, startDate, endDate) {
      return api.get('/api/study-accounting/cash-flow', { 
        params: { userId, startDate, endDate } 
      })
    },
    
    // 获取财务报表
    getFinancialReport(userId, startDate, endDate) {
      return api.get('/api/study-accounting/financial-report', { 
        params: { userId, startDate, endDate } 
      })
    }
  }
}




